
<body>
	
	<div id="box" style="width:600px;height:400px"></div>
	<script type="text/javascript" src="https://cdn.bootcss.com/echarts/3.8.5/echarts.min.js"></script>
	<script type="text/javascript">
		// 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('box'));


        // var dataDate = [{$dataDate}];

        // var dataNum = [{$dataNum}];


       	dataDate = [];
       	dataNum  = [];

        $.ajax({
        	url: '{:url('admin/count/userajax')}',
        	type: 'get',
        	dataType: 'json',
        	async: false
        })
        .done(function(res) {
        	for( var i in res.data ){
        		dataDate.push(res.data[i].dateline);
        		dataNum.push(res.data[i].reg_num);
        	} 
        	console.log(dataDate,dataNum);
        })
        .fail(function() {
        	console.log("error");
        })
        

         // 指定图表的配置项和数据
        option = {
		    title: {
		        text: '最近7天用户注册统计'
		    },
		    tooltip: {
		        trigger: 'axis'
		    },
		    legend: {
		        data:['注册量']
		    },
		    grid: {
		        left: '3%',
		        right: '4%',
		        bottom: '3%',
		        containLabel: true
		    },
		    toolbox: {
		        feature: {
		            saveAsImage: {}
		        }
		    },
		    xAxis: {
		        type: 'category',
		        boundaryGap: false,
		        data: dataDate
		    },
		    yAxis: {
		        type: 'value'
		    },
		    series: [
		        {
		            name:'注册量',
		            type:'line',
		            stack: '总量',
		            data:dataNum
		        }
		    ]
		};



        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);

	</script>
</body>
</html>